Skip to content

feat(itofin-py): add SwapIndex Python binding - #619

Merged
benbenbang merged 3 commits into
mainfrom
fable/614
Jul 27, 2026
Merged

feat(itofin-py): add SwapIndex Python binding#619
benbenbang merged 3 commits into
mainfrom
fable/614

Conversation

@benbenbang

@benbenbang benbenbang commented Jul 27, 2026

Copy link
Copy Markdown
Owner
  • feat(itofin-py): add SwapIndex Python binding
  • feat(itofin-py): expose InterpolatedSwaptionVolatilityCube facade
  • test(itofin-py): add interpolated swaption cube tests

close #614

This pull request exposes the core swap index to Python, so the volatility cubes can read the at-the-money forward from a vanilla swap's fair rate.

**New SwapIndex binding:**
* Added `crates/itofin-py/src/swapindex.rs` defining `PySwapIndex`, assembled from the index tenor, forecasting Euribor index, and fixed-leg conventions.
* Registered `PySwapIndex` in the `indexes` module in `src/lib.rs`.
* Supports both the default constructor (forecasting and discounting off the ibor index's forwarding curve) and `with_exogenous_discount` (discounting off a separate curve), plus `fixing`, `fixed_leg_tenor`, and `exogenous_discount` inspectors.

**Supporting changes:**
* Added a `PyPeriod::from_inner` helper in `src/time.rs` for inspectors that return a `Period`.
* Extended the hand-written stubs in `indexes.pyi` with the `SwapIndex` type and its new imports.
This adds a Python binding for the smile cube that layers bilinearly-interpolated volatility spreads over an at-the-money surface.

**New volatility cube facade:**
* Added `PyInterpolatedSwaptionVolatilityCube` in `swaptionvol.rs`, extending `PySwaptionVolatilityStructure` so the inherited `volatility` query takes a real strike, reading the at-the-money forward and vol off the base swap indexes and `atm_vol` and adding the interpolated spread.
* Validated the `vol_spreads` grid shape here, enforcing one row per `(option tenor, swap tenor)` node and one column per strike spread, and wired the quotes into the core cube.
* Exposed `atm_strike_from_tenor` on the concrete cube to serve the at-the-money strike a caller needs to place a smile query.

**Registration and supporting changes:**
* Registered the new class in the `termstructures` module in `lib.rs`.
* Dropped the `dead_code` allowance on `PySwapIndex::inner`, now consumed by the cube facade.
* Added hand-written stubs for `InterpolatedSwaptionVolatilityCube` in `termstructures.pyi`.
Add a new test file covering the interpolated swaption cube functionality
to validate its behavior.

Closes #614

close #614
@benbenbang
benbenbang enabled auto-merge (rebase) July 27, 2026 03:24
@github-actions github-actions Bot added the enhancement New feature or request label Jul 27, 2026
@benbenbang
benbenbang merged commit 3e830cc into main Jul 27, 2026
3 of 6 checks passed
@benbenbang
benbenbang deleted the fable/614 branch July 27, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[D7][itofin-py] Pass A3: PySwapIndex + PyInterpolatedSwaptionVolatilityCube (#605)

1 participant